"""TODO: header"""

import os

from google.appengine.ext import db
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template

from config import models as config_models


class ConfigPage(webapp.RequestHandler):
  def get(self):
    app_config = config_models.get_app_config()

    path = os.path.join(os.path.dirname(__file__), 'config_page.html')
    template_values = {
      'submission_fields': app_config.submission_fields,
    }
    self.response.out.write(template.render(path, template_values))


class EditFieldPage(webapp.RequestHandler):
  """A page displaying the specific edit form for a SubmissionField"""

  def get(self):
    submission_field = config_models.SubmissionField.get_by_id(
        int(self.request.get('field')))
    self.response.out.write(submission_field.get_edit_form())
